package o;

import com.huawei.hmf.orb.exception.ConnectRemoteException;
import com.huawei.hmf.orb.exception.ConnectRemoteException.e;

public final class fhr {
    private final Object ˋ = new Object();
    private volatile fhq ॱ;

    public fhq ॱ() {
        if (this.ॱ == null) {
            synchronized (this.ˋ) {
                if (this.ॱ == null) {
                    this.ॱ = new fhs(true);
                }
            }
        }
        return this.ॱ;
    }

    public synchronized fjo<ffd> ॱ(final ffa o_ffa) {
        final fjx o_fjx;
        o_fjx = new fjx();
        try {
            final Object ˋ = ˋ(o_ffa);
            if (ˋ.ˎ()) {
                o_fjx.ॱ(ˋ);
            } else {
                o_ffa.ˎ(new fex(this) {
                    final /* synthetic */ fhr ॱ;

                    public void ˋ() {
                        o_ffa.ˊ(this);
                        if (ˋ.ˎ()) {
                            o_fjx.ॱ(ˋ);
                        } else {
                            o_fjx.ॱ(new ConnectRemoteException(e.UnableBindService));
                        }
                    }

                    public void ˊ() {
                        o_ffa.ˊ(this);
                    }

                    public void ˊ(ConnectRemoteException connectRemoteException) {
                        o_ffa.ˊ(this);
                        o_fjx.ॱ((Exception) connectRemoteException);
                    }
                });
            }
        } catch (Exception e) {
            o_fjx.ॱ(e);
        }
        return o_fjx.ॱ();
    }

    private static ffd ˋ(ffa o_ffa) throws ConnectRemoteException {
        ffj ˊ = o_ffa.ˊ();
        if (ˊ != null) {
            return ˊ.ˎ(o_ffa);
        }
        throw new ConnectRemoteException(e.UnknownConnector);
    }
}
